{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from gs_quant.common import PayReceive\n",
    "from gs_quant.instrument import IRSwaption\n",
    "from gs_quant.session import Environment, GsSession"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# external users should substitute their client id and secret\n",
    "GsSession.use(Environment.PROD, client_id=None, client_secret=None, scopes=('run_analytics',))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# A swaption straddle represents the purchase of a payer swaption and\n",
    "# receiver swaption with the same strike and expiration_date\n",
    "straddle = IRSwaption(pay_or_receive='Straddle')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# The price of a straddle is sum of the price of the payer and receiver swaptions\n",
    "payer = IRSwaption(pay_or_receive=PayReceive.Pay)\n",
    "receiver = IRSwaption(pay_or_receive=PayReceive.Receive)\n",
    "\n",
    "print(straddle.price())\n",
    "print(payer.price() + receiver.price())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "tags": [
    "Instrument - Swaption Straddle"
   ],
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
